package com.atguigu.easyExcel;

import com.alibaba.excel.EasyExcel;

import java.util.ArrayList;
import java.util.List;

public class ExcelWriteDemo {

    public static void main(String[] args) {
        //1 指定excel文件所在目录和文件名称
        String filename = "D:\\0728.xlsx";

        //2 调用方法进行写操作
        EasyExcel.write(filename,Stu.class)
                .sheet("写操作")
                .doWrite(getData());
    }

    private static List<Stu> getData() {
        List<Stu> list = new ArrayList<Stu>();
        for (int i = 0; i < 10; i++) {
            Stu data = new Stu();
            data.setSno(i);
            data.setSname("张三"+i);
            list.add(data);
        }
        return list;
    }
}
